home *** CD-ROM | disk | FTP | other *** search
- Path: jove.acs.unt.edu!rortega
- From: Reynaldo Ortega <rortega@jove.acs.unt.edu>
- Newsgroups: comp.lang.c
- Subject: Turbo C beginner: string question? Please help!
- Date: Wed, 3 Apr 1996 06:02:20 -0600
- Organization: University of North Texas
- Message-ID: <Pine.SOL.3.91.960403054553.29446A-100000@jove.acs.unt.edu>
- NNTP-Posting-Host: jove.acs.unt.edu
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=US-ASCII
-
- /* A simple string example */
-
- main()
- {
- char str[80];
-
- printf("enter you name: ");
-
- gets(str);
-
- printf("hello %s", str);
- }
-
- QUESTION:
- let's say I entered the name TARANTINO, and I wanted to compare each
- single character in the string to display a count of occurences of
- each character. How would I code this? Here is an example to clarify
- what I am asking:
- ************************************************************
- enter your name: Tarantino
- hello Tarantino
- Tarantino has: 2 - t
- Tarantino has: 2 - a
- Tarantino has: 1 - r
- Tarantino has: 2 - n
- Tarantino has: 1 - i
- Tarantino has: 1 - o
- **************************************************************
- Thanx for any help,
-
- Ray e-mail: rortega@jove.acs.unt.edu
-